package com.zbkj.common.result;

import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import com.zbkj.common.exception.BusinessExceptionAssert;

public enum AssistantResultCode implements BusinessExceptionAssert {

    ASSISTANT_CONVERSATION_NOT_EXIST(15001, "会话不存在"),
    ASSISTANT_COMPLETED(15002, "会话已结束"),
    MESSAGE_CONTENT_TYPE_PRODUCT_NOT_EXIST(15003, "请选择正确的商品"),
    MESSAGE_CONTENT_TYPE_ORDER_NOT_EXIST(15004, "请选择正确的订单"),
    MESSAGE_CONTENT_TYPE_REFUND_ORDER_NOT_EXIST(15005, "请选择正确的退款单"),
    GROUP_DEFAULT_NOT_DELETE(15006, "默认分组不能删除"),
    CONVERSATION_CANT_COMPLETE(15007, "当前会话不支持状态流转"),
    MESSAGE_CANT_FEEDBACK(15008, "当前会话不支持评价"),
    ASSISTANT_GROUP_ACCOUNT_NOT_EXIST(15009, "客服账号不存在"),
    CONVERSATION_NOT_YOURS(15010, "不是你的会话"),
    CONVERSATION_CANT_TRANSFER_TO_SELF(15011, "会话无需转给自己"),
    CONVERSATION_NOT_SERVICE(15012, "会话状态不是服务中"),
        ;

    AssistantResultCode(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    /**
     * 响应状态码
     */
    private Integer code;
    /**
     * 响应信息
     */
    private String message;
    /**
     * 响应信息补充
     */
    private Object[] msgParams;


    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public AssistantResultCode setCode(Integer code) {
        this.code = code;
        return this;
    }

    @Override
    public String getMessage() {
        if (ArrayUtil.isNotEmpty(msgParams)) {
            return StrUtil.format(message, msgParams);
        }
        return message;
    }

    @Override
    public AssistantResultCode setMessage(String message) {
        this.message = message;
        return this;
    }

    @Override
    public IResultEnum setMsgParams(Object... msgParams) {
        this.msgParams = msgParams;
        return this;
    }

    @Override
    public Object[] getMsgParams() {
        return msgParams;
    }
}
